package com.example.serverSide.controller;

import com.example.serverSide.commom.ResultData;
import com.example.serverSide.commom.dto.OrderDto;
import com.example.serverSide.service.ProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/order")
public class ProductOrderController {
    @Autowired
    ProductOrderService productOrderService;
    @GetMapping("/orderList")
    public ResultData getOrderList(){
        List<OrderDto> productOrders = productOrderService.getOrderList();
        return ResultData.success(productOrders);
    }
}
